<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>日常费用报销申请</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="__STATIC__/layout/favicon.ico"> 
    <link href="__STATIC__/layout/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__STATIC__/layout/css/font-awesome.css?v=4.4.0" rel="stylesheet">
     <!-- jqgrid-->
    <link href="__STATIC__/layout/css/animate.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
     <link rel="stylesheet" href="__STATIC__/layout/css/channel.css" type="text/css">
    <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">

<link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
</head>

<body style="color:#333;padding:3px;">
    <!-- 标题 -->
    <div class="page-heade">
      <h2 class="title_color text-center">日常费用报销申请</h2>
    </div>
    <!-- 标题 -->
    <form id="f1" class="form-inline">
    <input type="hidden" name="aid" value="{$aid}"/>
   <table class="table-bordered table" style="margin: 2px 0">
	 <tr>
		<td>
        <button class="btn btn-info" type="button" onclick="daochu({$aid})">导出Excel打印版</button>
		</td>
	 </tr>
	 <tr>
		<td>
			<p>温馨提示：请在发票粘贴联上注明此申请单编号：<span class="font-bold colorRed">2016122800012</span><a href="javascript:;">点击查看图例</a></p><br>
			<p>并邮寄至：<span class="font-bold">广东省广州市番禺大道北383号6栋801 </span>
				<span class="font-bold">曾小姐收</span> ，<span class="font-bold">020-85518159</span>，<span class="font-bold">李四</span>， <span class="font-bold">13600000000</span>签收</p>
		</td>
	 </tr>
   </table>
     <table class="table table-bordered text-center bud_hei" style="margin-bottom: 0">
        <tr>
          <td style="min-width: 160px;width: 160px">单号</td>
            <td class="text-left" colspan="3">{$apply.no}</td>
        </tr>
        <tr>
            <td style="min-width: 160px;width: 160px">代办人(申请人)：</td>
            <td class="text-left">{$apply.cman}</td>
            <td style="min-width: 160px;width: 160px">报销单创建日期：</td>
            <td class="text-left">{$apply.ctime}</td>
        </tr>
        <tr>
            <td style="min-width: 160px;width: 160px">报销单主题：</td>
            <td class="text-left" colspan="3">{$apply.title}</td>
        </tr>
        <tr>
            <td style="min-width: 160px;width: 160px">报销归入考核期：</td>
            <td class="text-left">{$apply.kaohe}</td>
            <td style="min-width: 160px;width: 160px">支付方式：</td>
            <td class="text-left">{$apply.payway}</td>
        </tr>
         <tr>
            
            <td style="min-width: 160px;width: 160px">报销事由：</td>
            <td class="text-left"  colspan="3">{$apply.reason}</td>
        </tr>
        <tr>
            <td style="min-width: 160px;width: 160px">费用计入部门：</td>
            <td class="text-left">{$apply.jrbm}</td>
            <td style="min-width: 160px;width: 160px">报销人：</td>
            <td class="text-left">{$apply.bman}</td>
        </tr>
        <tr>
            <td style="min-width: 160px;width: 160px">关联出差申请单号：</td>
            <td class="text-left">
                {if $apply.chuchai}
                    <div class="row">
                        {volist name="$apply.chuchai" id="c"}
                            <div class="col-xs-4">
                                <a class="J_menuItem detail" title="{$c.no}" href="{:url('Chuchai/detail')}?aid={$c.id}">{$c.no}({$c.title})</a>
                            </div>
                        {/volist}
                    </div>
                {else/}
                    <b>无关联的出差申请</b>
                {/if}
            </td>
            <td></td>
            <td></td>
        </tr>
          <tr>
            <td style="min-width: 160px;width: 160px">关联万用申请单号：</td>
            <td class="text-left" colspan="3">
                {if $apply.wanneng}
                    <div class="row">
                        {volist name="$apply.wanneng" id="c"}
                            <div class="col-xs-4">
                                <a class="J_menuItem detail" title="{$c.no}" href="{:url('Wanyongapply/detail')}?aid={$c.id}">{$c.no}({$c.title})</a>
                            </div>
                        {/volist}
                    </div>
                {else/}
                    <b>无关联的万能申请</b>
                {/if}
            </td>
        </tr>
        {if $apply.state==8}
            <tr>
                <td style="min-width: 160px;width: 160px">作废人：</td>
                <td class="text-left">{$apply.zuofeiman}</td>
                <td style="min-width: 160px;width: 160px">作废时间：</td>
                <td class="text-left">{$apply.zuofeitime}</td>
            </tr>
             <tr>
            <td style="min-width: 160px;width: 160px">作废原因：</td>
            <td class="text-left" colspan="3">
               {$apply.zuofeireason}
            </td>
        </tr>
        {/if}
    </table>
     <table class="table table-bordered text-center bud_hei">
      <tr>
        <th class="font-bold" colspan="11">金额单位：元</th>
      </tr>
        <tr class="info">
            <th class="text-center">审批人</th>
            <th class="text-center">序号</th>
            <th class="text-center">起止时间</th>
            <th class="text-center">出发地点</th>
            <th class="text-center">到达地点</th>
            {volist name="feiyong" id="f"}
                <th class="text-center">{$f.title}</th>
            {/volist}
            <th class="text-center">费用说明</th>
            <th class="text-center">费用计入<br>经销商</th>
            <th class="text-center">状态</th>
        </tr>
        {volist name="applyde" id="de" key="k"}
         <tr>
           <td>{$de.em_name}</td>
           <td>{$k}</td>
           <td>从{$de.start} <br>至{$de.end}</td>
           <td class="text-left">{$de.chufa}</td>
           <td class="text-left">{$de.mudi}</td>
           {volist name="feiyong" id="f" key="fk"}
                <td class="text-right">
                    <span class="ObjectNum num2">
                   
                        {if $de.feiid==$f.id}
                            {$de.feis}
                        {/if}
                    
                    </span>/
                    <span class="ObjectNum num2 jisuan{$fk}">
                     
                        {if $de.feiid==$f.id}
                            {$de.pizhunfeiyong}
                        {/if}
                    
                    </span>
                </td>
            {/volist}
           <td>{$de.remark}</td>
           <td>{$de.jxs}</td>
           <td>{if $de.state==1}正常{elseif $de.state==2/}通过{else/}未通过{/if}</td>
        </tr>
        {/volist}
        <tr class="trTotal1 font-bold text-right">
            <td colspan="5" class="text-right font-bold">合计</td>
            {volist name="feiyong" id="f" key="fk"}
            <td class="ObjectNum num2 he{$fk}">100</td>
            {/volist}
            <td colspan="3">报销总金额：<span class="ObjectNum num2 zonghe">110</span>元</td>
        </tr>
        </table>
         {if $apply.fujian}
            <table class="table-bordered table" style="margin-top:0">
            <tr>
              <td>附件列表</td>

            </tr>
            <tr><td>
               {volist name="fujian" id="f"}
                    <a onclick="down({$f.id})">{$f.file_name}</a>&nbsp;&nbsp;
                  {/volist}
            </td></tr>
              </table>
                
        {/if}
        {if $apply.state==7}
      <div class="applyImg font-bold">
        申&nbsp;报&nbsp;已&nbsp;生&nbsp;效
      </div>
      {/if}
      {if $apply.state==8}
      <div class="applyImg font-bold">
        已&nbsp;作&nbsp;废
      </div>
      {/if}
         <table class="table table-bordered text-left bud_hei">
            <tr class="info">
                <th class="text-left font-bold">审批意见</th>
            </tr>
          <tr>
              <td>华东大区-华东大区经理 <a href="javascript:;">曾小倩</a>审批动作：抄送；审批意见：OK(审批时间：2017-02-20 11:50:23)</td>
          </tr>
            <tr>
              <td>华东大区-华东大区经理 <a href="javascript:;">曾小倩</a>审批动作：抄送；审批意见：无(审批时间：2017-02-20 11:50:34)</td>
          </tr>
      </table>
		 <table class="table table-bordered text-left bud_hei">
            <tr>
                <th class="text-left info">支付信息</th>
            </tr>
            <tr><td>总报销金额：<span class="ObjectNum num2">{$apply.pizhunjin}</span>元 已支付金额：<span class="ObjectNum num2">{$apply.zhifujin}</span>元 未支付金额：<span class="ObjectNum num2">{$apply.weifujin}</span>元</td></tr>
            {if $zhifu}
            {volist name="zhifu" id="z"}
            <tr>
                
                <td>支付信息：费用凭证：<span>{$z.pzno}</span> 录入人：<span>{$z.cu}</span> 录入时间：<span>{$z.ctime}</span>
                    支付人：<span>{$z.pu}</span>  支付时间：<span>{$z.zftime}</span> 支付金额：<span class="ObjectNum num2">{$z.jine}</span>元
                </td>
               
            </tr>
             {/volist}
             {/if}
                
              
       
            <tr>
            <td>
				<div class="form-group">
					费用凭证：<span class="colorRed">*</span><input type="text" class="form-control" name="pzno" style="min-width: 120px;width: 120px">
				</div>
				<div class="form-group" style="min-width: 400px">
					
					 <div class="container-fluid">
                            <div class="row">
                                <div class="col-xs-4">
                                支付人：<span class="colorRed">*</span>
                                </div>
                                <div class="col-xs-8">
                                    <div class="input-group"   >
                                        <input type="text" placeholder="请输入关键字或空格查询" class="zfuser form-control"  name="zfuser">
                                        <div class="input-group-btn">
                                            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                                <span class="caret"></span>
                                            </button>
                                            <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                            </ul>
                                        </div>
                                    </div>
                                    <div class="selectedOnlyOne " style="display:none;"  >
                                      
                                        <span class="inin"></span>
                                        <span class="close">×</span>
                                    </div>
                                </div>
                             
                           </div>
                        </div>
				</div>
				<div class="form-group">
					支付日期：<span class="colorRed">*</span>
					<input type="text" class="form-control layer-date" id="hello" name="zftime" style="min-width: 140px;width: 140px">
				</div>
				<div class="form-group">
					本次支付金额：<span class="colorRed">*</span>
					<input type="text" class="form-control num2" name="jine" style="min-width: 120px;width: 120px">元
				</div>
            </td>
           </tr>
           <tr>
				<td>支付备注：<input type="text" class="form-control" name="remark"></td>
           </tr>
        </table>
        <div class="padding-10 row-margin-top text-center">
			<button class="btn btn-success"  type="button" onclick="save()">保存支付凭证</button>
			<button class="btn btn-warning" onclick="back()" type="button">返回</button>
        </div>
</form>
      
    <!-- 全局js -->
    <script src="__STATIC__/layout/js/jquery.min.js?v=2.1.4"></script>
    <script src="__STATIC__/layout/js/bootstrap.min.js?v=3.3.6"></script>
    <!-- <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> -->
    <script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
      <script src="__STATIC__/layout/js/plugins/layer/laydate/laydate.js"></script>
        <script src="__STATIC__/layout/js/common.js"></script>

<script src="__STATIC__/layout/js/plugins/sweetalert/sweetalert.min.js"></script>
<script src="__STATIC__/layout/js/plugins/layer/layer.min.js"></script>
<script src="__STATIC__/layout/js/plugins/suggest/bootstrap-suggest.min.js"></script>
        <script>
        function daochu(aid){
            window.open("{:url('Rcexecel/mingxi')}?aid="+aid)
        }
        function save(){
                   $.ajax({
                      cache: true,
                      type: "POST",
                      url:"{:url('zhifuchuli')}",
                      data:$('#f1').serialize(),// 你的formid
                      async: false,
                      error: function(request) {
                        alert("Connection error");
                      },
                      success: function(data) {
                        //alert(data);
                         var re=JSON.parse(data);
                         if(re["state"]==2){
                            swal({
                                title: "错误",
                                text:  re["msg"],
                                type: "warning"
                                });
                        }else{
                            swal({
                                title: "完成",
                                text:  "操作已成功",
                                type: "success"
                            },function(){
                                location.href="{:url('cost1')}"
                            })
                        }
                      }
                    });
        }
        function back(){
          location.href="{:url('cost1')}";
        }
        $(".num2").blur(function(){
            if(isNaN(parseFloat($(this).val())))
              $(this).val("0.00");
            else
              $(this).val(parseFloat($(this).val()).toFixed(2));
        })
         //取消单选
    $('body').on('click','.selectedOnlyOne .close',function () {
        $(this).closest('.selectedOnlyOne').hide().find('.inin').html('')
        $(this).closest('.selectedOnlyOne').prev('.input-group').show().find('input').val('')
    })
        //支付人搜索自动补全
    $(".zfuser").bsSuggest({
        url: "{:url('Apcaiwu/cnamejson')}",
        /*effectiveFields: ["userName", "shortAccount"],
         searchFields: [ "shortAccount"],*/
        effectiveFieldsAlias:{title: "名称"},
        ignorecase: true,
        showHeader: true,
        showBtn: false,     //不显示下拉按钮
        delayUntilKeyup: true, //获取数据的方式为 firstByUrl 时，延迟到有输入/获取到焦点时才请求数据
        idField: "id",
        keyField: "title",
        clearable: true
    }).on('onSetSelectValue', function (e, keyword, data) {
        $(this).closest('.input-group').hide().next('.selectedOnlyOne').show().find('.inin').html(keyword.key)
        $(this).val(keyword.id)

    });
                $(document).ready(function(){
                    $(".num2").each(function(){
                        if(isNaN(parseFloat($(this).html()))){
                             $(this).html("0.00")
                        }else{
                            $(this).html(parseFloat($(this).html()).toFixed(2))
                        }
                    })
                    var feinum={$feiyongnum};
                    var zonghe=0;
                    for(var i=1;i<=feinum;i++){
                        var he=0;
                        $(".jisuan"+i).each(function(){
                            he+=parseFloat($(this).html());
                        })
                        $(".he"+i).html(he);
                        zonghe+=parseFloat(he);
                    }
                    $(".zonghe").html(zonghe)
                    
            var $ObjectNum =$(".ObjectNum");
               toNum($ObjectNum);
        });
          laydate({
            elem: '#hello', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
            event: 'focus' //响应事件。如果没有传入event，则按照默认的click
        });
        </script>
</body>

</html>
